import com.hxz.pojo.Bird;
import com.hxz.pojo.FactoryPostProcessor;
import com.hxz.pojo.MyFactoryBeanBean;
import com.hxz.pojo.Student;
import com.hxz.service.AService;
import com.hxz.service.BService;
import com.hxz.service.UserService;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MyTest1 {
    @Test
    public void testp() {
        ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("beans.xml");
//        Object student = ac.getBean("mybean");
//        Object mybean = ac.getBean("mybean");
//        Object bean = ac.getBean("&mybean");
//        MyFactoryBeanBean bean = ac.getBean(MyFactoryBeanBean.class);
//        FactoryPostProcessor bean = ac.getBean(FactoryPostProcessor.class);

//        Object bean = ac.getBean("&mybean");
//        //添加事件测试
//        MessageEvent myListener = new MessageEvent("beijing","13670000000","hello!");
//        ac.publishEvent(myListener);
//        People people = (People) ac.getBean("people");
//        people.getCat().shut();
//        people.getDog().shut();
//        System.out.println(people);
//        //动态代理的是接口
//        UserService userService = ac.getBean("userService", UserService.class);
//        MyBean myBean = (MyBean) ac.getBean("mybean");
//        MyBean myBean1 = (MyBean) ac.getBean("&mybean");
//        MyBean myBean2 = ( MyBean) ac.getBean("&mybean");
//        System.out.println(myBean);
//        System.out.println(myBean1);
//        System.out.println(myBean2);
//        userService.add();
//        AbstractApplicationContext aac= (AbstractApplicationContext) ac;
//        aac.close();
//        Bird bean = ac.getBean(Bird.class);
//        Object aService = ac.getBean("aService");
//        Object people = ac.getBean("people");
//        Object bService = ac.getBean("bService");
        AService bean = ac.getBean(AService.class);
        System.out.println();
    }

    @Test
    public void test2(){
        System.out.println(4.0-3.6);
    }
}
